export default function (Node) {
    return Node.create({
        name: "Contract",
        group: "inline",
        inline: true,
        atom: true,
        content: "text*",
        addAttributes() {
            return {
                id: "",
            };
        },
        parseHTML() {
            const field = [
                {
                    tag: "span.c-contract",
                    getAttrs: (dom) => {
                        const id = dom.getAttribute("id");
                        return { id };
                    },
                },
            ];
            return field;
        },
        renderHTML({ HTMLAttributes }) {
            const { id } = HTMLAttributes;
            const { _fieldsData } = window;
            return [
                "span",
                {
                    class: "c-contract",
                },
                _fieldsData[id],
            ];
        },
    });
}
